package top.jiangqiang.qianyi.common.exception;

import lombok.extern.slf4j.Slf4j;
import top.jiangqiang.qianyi.common.base.http.BaseStatus;
import top.jiangqiang.qianyi.common.constants.http.Error500Status;


/**
 * 大多数情况下使用此异常类型
 * 此异常统一处理为json响应
 *
 * @author jiangqiang
 * @date 2022-07-24
 */
@Slf4j
public class Error500Exception extends BaseException {

    protected static final BaseStatus STATUS = Error500Status.INTERNAL_SERVER_ERROR;

    public Error500Exception() {
        super(STATUS);
    }
    /**
     * @param baseException 异常
     */
    public Error500Exception(BaseException baseException) {
        super(STATUS, baseException.getMessage());
    }

    /**
     * @param cause 异常
     */
    public Error500Exception(Throwable cause) {
        super(STATUS, STATUS.getMessage(), cause);
    }

    /**
     * @param cause 异常
     */
    public Error500Exception(Throwable cause, String reason, Object... params) {
        super(STATUS, reason, cause, params);
    }

    /**
     * @param reason 异常原因
     * @param params 模板参数
     */
    public Error500Exception(String reason, Object... params) {
        super(STATUS, reason, params);
    }

    /**
     * @param errorStatus 错误枚举
     */
    public Error500Exception(Error500Status errorStatus) {
        super(errorStatus);
    }

    /**
     * @param errorStatus 错误枚举
     * @param reason      错误原因
     * @param params      参数，用于填充reason中的占位符
     */
    public Error500Exception(Error500Status errorStatus, String reason, Object... params) {
        super(errorStatus, reason, params);
    }

    /**
     * @param errorStatus 错误枚举
     * @param cause       异常
     */
    public Error500Exception(Error500Status errorStatus, Throwable cause) {
        super(errorStatus, cause);
    }

}
